package mycharstream;

import java.io.FileReader;
import java.io.IOException;

public class demo2 {
    public static void main(String[] args) throws IOException {
        //创建对象
        FileReader fr = new FileReader("csb.txt");
        //创建char类型的数组
        char[]chars = new char[2];
        int len;
        //读取数据
        while ((len = fr.read()) != -1){
            System.out.print(new String(chars,0,len));
            System.out.println(len);
        }

        //释放资源
        fr.close();

    }
}
